require(rgeos)
require(maptools)
require(foreign)
require(rgdal)

###data
congo <- readShapePoly("COG_adm1.shp")
provinces  <- readShapePoly("Provinces_fromDivs_w_eth.shp", proj4string=CRS("+proj=longlat +datum=WGS84"), delete_null_obj=TRUE)
districts <- readShapePoly("SplitDistricts_010815_2.shp", proj4string=CRS("+proj=longlat +datum=WGS84"), delete_null_obj=TRUE)

####Plotting DSN Core Areas
pdf(file = "DSN_Core_areas.pdf", height = 6, width = 6)
plot(congo)
title(main = "Congo: Sassou Nguesso")
plot(congo[1,], add = T); #Bouzena
plot(congo[3,], add = T); #Brazzaville
plot(congo[3,], add = T,  col = "firebrick", density = 20, angle = 45); #Cuvette-Oueste
plot(congo[4,], add = T,  col = "firebrick", density = 20, angle = 45); #Cuvette
plot(congo[5,], add = T,  col = "firebrick", density = 20, angle = 45); #Pointe-Noire
plot(congo[6,], add = T); #LEkoumou
plot(congo[7,], add = T,  col = "firebrick", density = 20, angle = 45); #Likouala
plot(congo[8,], add = T); #Niari
plot(congo[9,], add = T,  col = "firebrick", density = 20, angle = 45); #Plauteaux
plot(congo[11,], add = T); #Pool
plot(congo[12,], add = T,  col = "firebrick", density = 20, angle = 45); #Sangha
dev.off()

##Plotting Moi Core Areas
pdf(file = "Moi_Core_areas.pdf", height = 6, width = 6)
plot(provinces)
title(main = "Kenya: Moi")
plot(districts[1,], add = T,  col = "firebrick", density = 20, angle = 45); #Baringo
plot(districts[2,], add = T, col = "firebrick", density = 20, angle = 45); #Bomet
plot(districts[3,], add = T); #Bondo
plot(districts[4,], add = T); #Bungoma
plot(districts[5,], add = T, col = "firebrick", density = 20, angle = 45); #Buret
plot(districts[6,], add = T); #Busia
plot(districts[7,], add = T); #Butere
plot(districts[8,], add = T, col = "firebrick", density = 20, angle = 45); #Eldama Ravine
plot(districts[9,], add = T, col = "firebrick", density = 20, angle = 45); #Elgeyo
plot(districts[10,], add = T); #Embu
plot(districts[11,], add = T); #Garissa
plot(districts[12,], add = T); #Gucha
plot(districts[13,], add = T); #HB
plot(districts[14,], add = T); #Ijara
plot(districts[15,], add = T); #Isiolo
plot(districts[16,], add = T); #Kajiado
plot(districts[17,], add = T); #Kakamega
plot(districts[18,], add = T, col = "firebrick", density = 20, angle = 45); #Kericho
plot(districts[19,], add = T); #Kiambu
plot(districts[20,], add = T); #Kilifi
plot(districts[21,], add = T); #Kirinyaga
plot(districts[22,], add = T); #Kisii
plot(districts[23,], add = T); #Kisumu
plot(districts[24,], add = T); #Kitui
plot(districts[25,], add = T); #Kuria
plot(districts[26,], add = T); #Kwale
plot(districts[27,], add = T); #Laikipia
plot(districts[28,], add = T); #Lamu
plot(districts[29,], add = T); #Lugari
plot(districts[30,], add = T); #Machakos
plot(districts[31,], add = T); #Makueni
plot(districts[32,], add = T); #Malindi
plot(districts[33,], add = T); #Mandera
plot(districts[34,], add = T); #Maragua
plot(districts[35,], add = T, col = "firebrick", density = 20, angle = 45); #Marakwet
plot(districts[36,], add = T); #Marsabit
plot(districts[37,], add = T); #Mbeere
plot(districts[38,], add = T); #Meru
plot(districts[39,], add = T); #Meru N
plot(districts[40,], add = T); #Migori
plot(districts[41,], add = T); #Mombasa
plot(districts[42,], add = T, col = "firebrick", density = 20, angle = 45); #Mt Elgon
plot(districts[43,], add = T); #Moyale
plot(districts[44,], add = T); #Muranga
plot(districts[45,], add = T); #Mwingi
plot(districts[46,], add = T); #NBO
plot(districts[47,], add = T); #Nakuru
plot(districts[48,], add = T, col = "firebrick", density = 20, angle = 45); #Nandi
plot(districts[49,], add = T, col = "firebrick", density = 20, angle = 45); #Nandi S
plot(districts[50,], add = T); #Narok
plot(districts[51,], add = T); #Nithi
plot(districts[52,], add = T); #Nyamira
plot(districts[53,], add = T); #Nyandarua
plot(districts[54,], add = T); #Nyando
plot(districts[55,], add = T); #Nyeri
plot(districts[56,], add = T); #Rach
plot(districts[57,], add = T); #Samburu
plot(districts[58,], add = T); #Siaya
plot(districts[59,], add = T); #Suba
plot(districts[60,], add = T); #TT
plot(districts[61,], add = T); #TR
plot(districts[62,], add = T); #Teso
plot(districts[63,], add = T); #Tharaka
plot(districts[64,], add = T); #Thika
plot(districts[65,], add = T); #TN
plot(districts[66,], add = T, col = "firebrick", density = 20, angle = 45); #TM
plot(districts[67,], add = T); #Turk
plot(districts[68,], add = T, col = "firebrick", density = 20, angle = 45); #UG
plot(districts[69,], add = T); #Vihigia
plot(districts[70,], add = T); #Wajir
plot(districts[71,], add = T, col = "firebrick", density = 20, angle = 45); #WP
dev.off()

###Plotting Kibaki Core Areas
pdf(file = "Kibaki_Core_areas.pdf", height = 6, width = 6)
plot(country)
title(main = "Kenya: Kibaki")
plot(districts[1,], add = T); #Baringo
plot(districts[2,], add = T); #Bomet
plot(districts[3,], add = T); #Bondo
plot(districts[4,], add = T); #Bungoma
plot(districts[5,], add = T); #Buret
plot(districts[6,], add = T); #Busia
plot(districts[7,], add = T); #Butere
plot(districts[8,], add = T); #Eldama Ravine
plot(districts[9,], add = T); #Elgeyo
plot(districts[10,], add = T); #Embu
plot(districts[11,], add = T); #Garissa
plot(districts[12,], add = T); #Gucha
plot(districts[13,], add = T); #HB
plot(districts[14,], add = T); #Ijara
plot(districts[15,], add = T); #Isiolo
plot(districts[16,], add = T); #Kajiado
plot(districts[17,], add = T); #Kakamega
plot(districts[18,], add = T); #Kericho
plot(districts[19,], add = T,  col = "firebrick", density = 20, angle = 45); #Kiambu
plot(districts[20,], add = T); #Kilifi
plot(districts[21,], add = T,  col = "firebrick", density = 20, angle = 45); #Kirinyaga
plot(districts[22,], add = T); #Kisii
plot(districts[23,], add = T); #Kisumu
plot(districts[24,], add = T); #Kitui
plot(districts[25,], add = T); #Kuria
plot(districts[26,], add = T); #Kwale
plot(districts[27,], add = T,  col = "firebrick", density = 20, angle = 45); #Laikipia
plot(districts[28,], add = T); #Lamu
plot(districts[29,], add = T); #Lugari
plot(districts[30,], add = T); #Machakos
plot(districts[31,], add = T); #Makueni
plot(districts[32,], add = T); #Malindi
plot(districts[33,], add = T); #Mandera
plot(districts[34,], add = T,  col = "firebrick", density = 20, angle = 45); #Maragua
plot(districts[35,], add = T); #Marakwet
plot(districts[36,], add = T); #Marsabit
plot(districts[37,], add = T); #Mbeere
plot(districts[38,], add = T); #Meru
plot(districts[39,], add = T); #Meru N
plot(districts[40,], add = T); #Migori
plot(districts[41,], add = T); #Mombasa
plot(districts[42,], add = T); #Mt Elgon
plot(districts[43,], add = T); #Moyale
plot(districts[44,], add = T,  col = "firebrick", density = 20, angle = 45); #Muranga
plot(districts[45,], add = T); #Mwingi
plot(districts[46,], add = T,  col = "firebrick", density = 20, angle = 45); #NBO
plot(districts[47,], add = T,  col = "firebrick", density = 20, angle = 45); #Nakuru
plot(districts[48,], add = T); #Nandi
plot(districts[49,], add = T); #Nandi S
plot(districts[50,], add = T); #Narok
plot(districts[51,], add = T); #Nithi
plot(districts[52,], add = T); #Nyamira
plot(districts[53,], add = T,  col = "firebrick", density = 20, angle = 45); #Nyandarua
plot(districts[54,], add = T); #Nyando
plot(districts[55,], add = T,  col = "firebrick", density = 20, angle = 45); #Nyeri
plot(districts[56,], add = T); #Rach
plot(districts[57,], add = T); #Samburu
plot(districts[58,], add = T); #Siaya
plot(districts[59,], add = T); #Suba
plot(districts[60,], add = T); #TT
plot(districts[61,], add = T); #TR
plot(districts[62,], add = T); #Teso
plot(districts[63,], add = T); #Tharaka
plot(districts[64,], add = T,  col = "firebrick", density = 20, angle = 45); #Thika
plot(districts[65,], add = T); #TN
plot(districts[66,], add = T); #TM
plot(districts[67,], add = T); #Turk
plot(districts[68,], add = T); #UG
plot(districts[69,], add = T); #Vihigia
plot(districts[70,], add = T); #Wajir
plot(districts[71,], add = T); #WP
dev.off()


